/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * StatisticsFrame.java
 *
 * Created on Jan 7, 2010, 2:12:57 PM
 */

package posturecorrectionsystem.gui;

import java.awt.BorderLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
import org.jfree.beans.JPieChart;
import org.jfree.data.general.DefaultPieDataset;

/**
 *
 * @author ahmet
 */
public class StatisticsFrame extends javax.swing.JFrame {

    /** Creates new form StatisticsFrame */
    public StatisticsFrame() {
        initComponents();
        DefaultPieDataset dataset = new DefaultPieDataset();
        dataset.setValue("Working Time", 8.0);
        dataset.setValue("Break time", 2.0);

        JPieChart pie = new JPieChart();
        pie.setDataset(dataset);

        JPanel jp = new JPanel();
        jp.setSize(100, 30);
        jp.setBackground(pie.getBackground());
        pie.setLayout(new BorderLayout());
        pie.add(jp, BorderLayout.SOUTH);

        getContentPane().setLayout(new BorderLayout());
        getContentPane().add(pie, BorderLayout.CENTER);

        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
//        this.addWindowListener(new WindowAdapter() {
//
//            @Override
//            public void windowClosing(WindowEvent we) {
//                super.windowClosing(we);
//                dispose();
//            }
//        });
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new StatisticsFrame().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables

}
